#!/usr/bin/perl
#fileter.cgi

require './shareman-lib.pl';

&ReadParse();
#--------New Text---------#
#$text{'filter'} = "File Filter";
#$text{'sharedir'} = "Share Path";
#$text{'norule'} = "No Filter Rule";
#$text{'ftallow'} = "Only allow";
#$text{'ftdeny'} = "Only deny";
#-------------------------#
&header($text{'filter'}, "", "index", 0, 1);
@ab=get_share_filter($in{'sharedir'});
@shareinfo=search_shareinfo($in{'sharedir'});
#print $shareinfo[1]."aaa";
print "<form name=ffilter action=savefilter.cgi method=post>\n";
my $ft = $ab[1];
my @filetype=split(",", $ab[2]);
if($ft eq "N"){
	$check0 = "checked";
	$check1 = "";
	$check2 = "";
}
elsif($ft eq "A"){
	$check0 = "";
	$check1 = "checked";
	$check2 = "";	
}
elsif($ft eq "D"){
	$check0 = "";
	$check1 = "";
	$check2 = "checked";	
}
print "<table class=mode1 width=80%>\n";
print "<tr><td width=400><b>$text{'sharedir'}:\t       </b>$in{'sharedir'}</td><td></td></tr>\n";
print "<tr><td><input type=radio name=filtertype value=0 $check0>$text{'norule'}</td><td></td></tr>\n";
print "<tr><td><input type=radio name=filtertype value=1 $check1>$text{'ftallow'}</td></tr>\n";
print "<tr><td><input type=radio name=filtertype value=2 $check2>$text{'ftdeny'}</td></tr>\n";
print "<tr><td><textarea name=filetype rows=6 cols=30 >";
foreach $gg (@filetype){
print $gg."\n";
}
print "</textarea>";
print "</td></tr>\n";
print "<tr><td><input type=submit name=submit class=button1 value=\"$text{'ok'}\"></td></tr>\n";
print "</table>\n";
#----Java Script-----#
print <<EOF;
<script>


</script>
EOF
print "<input type=hidden name=sharepath value=$in{'sharedir'}>";
print "<input type=hidden name=sharename value=$shareinfo[0]>";
print "<input type=hidden name=sharetype value=$shareinfo[1]>";
print "</form>\n";

&footer("index.cgi", $text{'index'});
